﻿using System;
using System.IO;
using System.Xml;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
//using org.drools.dotnet;
//using org.drools.dotnet.compiler;
//using org.drools.dotnet.rule;

namespace Plat.WfProcess.Engine
{
    public class IntWrapper
    {
        public int Value
        {
            get;
            set;
        }

        public IntWrapper(int value)
        {
            Value = value;
        }
    }

    //public class DroolsRuleManager
    //{
    //    private PackageBuilder builder;
    //    private Package package;
    //    private RuleBase ruleBase;
    //    private WorkingMemory workingMemory;
    //    private org.drools.FactHandle factHandle;

    //    internal void ParseXmlRule(string fileName)
    //    {
    //        try
    //        {
    //            string physicalFileName = System.Environment.CurrentDirectory.Replace("\\bin\\Debug", "");
    //            physicalFileName += "\\Xml\\" + fileName;

    //            XmlDocument xmlDoc = new XmlDocument();
    //            xmlDoc.Load(physicalFileName);

    //            string strRule = xmlDoc.DocumentElement.InnerText;

    //            Stream stream = new MemoryStream(ASCIIEncoding.ASCII.GetBytes(strRule));
    //            builder = new PackageBuilder();

    //            builder.AddPackageFromDrl("Plat.WfProcess.Engine.Rule.SimpleRule.drl", stream);
                
    //            package = builder.GetPackage();

               

    //            ruleBase = RuleBaseFactory.NewRuleBase();
    //            ruleBase.AddPackage(package);

    //            workingMemory = ruleBase.NewWorkingMemory();

    //            var i = new IntWrapper(-2);
    //            factHandle = workingMemory.assertObject(i);
    //            workingMemory.fireAllRules();
    //            var newObj = workingMemory.getObject(factHandle);

    //            workingMemory.dispose();


    //        }
    //        catch (org.drools.compiler.DroolsParserException dx)
    //        {
    //            throw new Exception("Drools 无法正确解析规则文件！");
    //        }
    //        catch (System.Exception ex)
    //        {
    //            throw;
    //        }
    //    }

    //    internal void test()
    //    {
                      
            
    //    }

    //    public static void PrintMessage(string message)
    //    {
    //        System.Console.WriteLine(string.Format("This message is from console. the result is: {0}", message));
    //    }
    //}
}
